import {Component} from '@angular/core';
import {App, IonicPage, NavController, NavParams} from 'ionic-angular';
import {LocalStorage} from "../../utils/localstorage.utils";
import {ACTIVITY} from "../../api/activity.api";
import moment from "moment"

@IonicPage()
@Component({
  selector: 'page-activity-detail',
  templateUrl: 'activity-detail.html',
})
export class ActivityDetailPage{
  actId:string;
  activity = [
    {
    image: 'assets/images/active-1.jpg',
    title: '篮球风暴，让我们燥起来吧',
    time: new Date(),
    readCount: 123,
    content: '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;夏天来了，太阳很大，天气很热，想吃着冷饮吹着空调不出门是不是。可是，健康的身体需要运动，健康的夏天也不能不流汗。' +
    '为了帮你打败懒癌，青果寓夏季篮球赛开始啦!大管家已经帮你准备好了一切,你只需要带上你精湛的球技和似火的热情就可以啦。<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' +
    '即日起，到自己所居住的青果寓门店管理处进行报名，我们将根据报名情况安排比赛时间和队伍。来吧，让我们在这个夏天燥起来吧。'
  }
  ];

  actDetail:any={}
  constructor(public navCtrl: NavController,public ACTIVITY: ACTIVITY, public navParams: NavParams,private app: App,private ls:LocalStorage) {
    this.actId = this.ls.get('actId');
    console.log(this.actId);
  }
  formatDate(date):string {
    return moment(date).format('YYYY-MM-DD')
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad ActivityDetailPage');
    this.ACTIVITY.getDetail(this.actId,(resp)=>{
      this.actDetail = resp;
    })
  }
}
